/**
 * @ClassName Day10LC160
 * @Description TODO
 * @Author clockTown
 * @Date 2021/9/19 20:36
 * @Version 1.0
 */
public class Day10LC160 {
    public ListNode getIntersectionNode(ListNode headA, ListNode headB) {
        ListNode nodeA = headA;
        ListNode nodeB = headB;
        while (nodeA != nodeB) {
            nodeA = nodeA == null ? headB: nodeA.next;
            nodeB = nodeB == null ? headA: nodeB.next;
        }
        return nodeA;
    }
}
